/**
 * Copyright (C), 2015-2019, bogewang
 * FileName: MyCommandLineRunner
 * Author:   foren236598164@aliyun.com
 * Date:     2019/8/29 16:37
 * Description: 项目监听
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.bogewang;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 〈项目启动时,开启监听〉<br>
 * 〈项目监听〉
 *
 * @author foren236598164@aliyun.com
 * @create 2019/8/29
 * @since 1.0.0
 */
//@Component
@Slf4j
public class MyCommandLineRunner implements CommandLineRunner {

    @ApolloConfig
    private Config config;

    @Override
    public void run(String... args) throws Exception {
        config.addChangeListener((changeEvent)-> log.info("####分布式配置中心监听####" + changeEvent.changedKeys().toString()));
    }
}